package spring.bean;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import spring.bean.cofig.AppConfig;

public class Test {
    public static void main(String[] args) {
        System.out.println("启动 Spring 容器...");
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(AppConfig.class);
        System.out.println("Spring 容器已启动");

        MyBean bean = context.getBean(MyBean.class);
        System.out.println("8. Bean 已就绪，可正常使用：" + bean);

        System.out.println("关闭 Spring 容器...");
        context.close();
        System.out.println("Spring 容器已关闭");
    }
}
